function transition() {
	var that;
}

transition.prototype = {
	sequence:'',
	meet_id:'',
	round:'',
	url:'/tug/screen/statistic',
	init:function() {
		that = this;
		that.sequence = that.getItems("sequence");
		that.meet_id = that.getItems("meet_id");
		that.round = that.getItems("round");
		var A_id = that.getItems("A_id");
		var B_id = that.getItems("B_id");
		var data = {sequence:that.sequence,round:that.round,A_id:A_id,B_id:B_id,meet_id: that.meet_id};
			that.request_data(that.url,data,that.statisticCallback,that.statisticErrorCallback);

	},
	statisticCallback:function(ret) {
		console.log(ret);
		if(parseInt(ret.res) == 1) {
			that.setItems("A_shake",ret.left_shake);
			that.setItems("B_shake",ret.right_shake);
			window.location.href = '/tug/runtime/result' + window.location.search;
		}
	},
	statisticErrorCallback:function() {
		// window.location.href = "/tug/runtime/result?meet_id"+that.meet_id+"&sequence="+that.sequence+"&round="+that.round;
	},
	setItems:function(key,value) {
		sessionStorage.setItem(key,value);
	},
	getItems:function(key) {
		return sessionStorage.getItem(key);
	},
	request_data:function(url,data,callback,errorCallback) {
		$.ajax({
			type:"post",
			url:url,
			dataType:"json",
			data:data,
			success:function(ret) {
				callback && callback(ret);
			},
			error:function() {
				errorCallback && errorCallback();
			}
		})
	},
	getQueryString:function(name) { 
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); 
        var r = window.location.search.substr(1).match(reg); 
        if (r != null) return unescape(r[2]); return null; 
    }
}

$(function() {
	var obj = new transition();
		obj.init();
})